<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<head th:replace="/layout :: htmlhead" th:with="title='后台管理'">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-form-item" lay-filter="searchForm">
                <form class="layui-form" method="post">
                    <label class="layui-form-label">机构名称</label>
                    <div class="layui-input-inline">
                        <input id="nameSearch" name="nameSearch" class="layui-input" type="text"/>
                    </div>
                    <label class="layui-form-label">机构编号</label>
                    <div class="layui-input-inline">
                        <input id="cyqxhSearch" name="cyqxhSearch" class="layui-input" type="text"/>
                    </div>
                </form>
                <div class="layui-input-inline">
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    <button class="layui-btn" lay-submit="" lay-filter="searchSubmit">查询</button>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">
                    <h2><b>机构列表</b></h2>
                </div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="table" lay-filter="table"></table>

                    <script type="text/html" id="isOrganType">
                        {{#  if(d.organtype == 0){ }}
                        省级管理机构
                        {{#  } else if(d.organtype == 1){ }}
                        市级管理机构
                        {{#  } else if(d.organtype == 2){ }}
                        县级管理机构
                        {{#  } else if(d.organtype == 3){ }}
                        查验单位
                        {{#  } }}
                    </script>
                    <script type="text/html" id="table-toolbar">
                        <a class="layui-btn layui-btn-normal layui-btn-xs " lay-event="add" lay-submit="" shiro:hasPermission="organ:add" >新建</a>
                        <a class="layui-btn layui-btn-xs " lay-event="edit"  shiro:hasPermission="organ:edit">编辑</a>
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"
                           shiro:hasPermission="organ:del">删除</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="organEdit" class="layer_self_wrap layui-form" style="display:none;">
    <form id="organForm" lay-filter="organForm" style="margin-top: 20px" class="layui-form layui-form-pane" >
        <input name="porgan" type="hidden">
        <input type="hidden" id="oper" >
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">查验区序号</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input lay-verify="required|xyh" name="cyqxh" placeholder="创建后不可修改" class="layui-input"
                               type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">查验区名称</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input name="name" lay-verify="required|qmc" placeholder="查验区名称" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">机构简称</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input name="cyjgjc" lay-verify="required|jgjc" placeholder="查验机构简称" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">机构类型</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <select name="organtype">
                            <option value="0">0:省级管理机构</option>
                            <option value="1">1:市级管理机构</option>
                            <option value="2">2:县级管理机构</option>
                            <option value="3">3:查验单位</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">排序</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input name="seq" lay-verify="number" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">菜单图标</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input name="icon" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">机构经度(°)</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input name="lng" lay-verify="jggd" placeholder="精确到小数点后六位" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">机构纬度(°)</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input  name="lat" lay-verify="jgwd" placeholder="精确到小数点后六位" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">地址</label>
                    <div class="layui-input-inline" style="width: 55%">
                        <input  name="address" lay-verify="diz" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">视频下载</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <select name="lxxzpz" lay-filter="lxxzpz">
                            <option value="0">不下载</option>
                            <option value="1">仅通道视频</option>
                            <option value="2">仅执法记录仪视频</option>
                            <option value="3">全部下载</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div id="zdfwqdzDiv" hidden class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">IIS虚拟路径</label>
                    <div style="width: 75%" class="layui-input-inline">
                        <input name="zdfwqdz" placeholder="IIS虚拟路径地址：如http://172.24.1.193/hikideo/" autocomplete="off"
                               class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">授权方式</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <select name="sqfs">
                            <option value="1">临时授权（128位）</option>
                            <option value="0">永久授权（32位）</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 33%">授权码</label>
                    <div class="layui-input-inline" style="width: 55%">
                        <input name="sqm" lay-verify="required" placeholder="32位授权码" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">站点服务器IP</label>
                    <div class="layui-input-inline" style="width: 55%">
                        <input  name="ip" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label style="width: 33%;" class="layui-form-label">站点服务器端口</label>
                    <div style="width: 55%" class="layui-input-inline">
                        <input  name="port" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item"style="float: right; margin-right: 50px;margin-top: 100px">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submitOrgan" >确定</button>
                <button type="button" class="layui-btn layui-btn-primary"  onclick="submitCancel()" >取消</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        var editIndex = layedit.build('LAY_demo_editor');

        //自定义验证规则
        form.verify({
            qmc: function (value) {
                if (value.length>16) {
                    return '不得超过16个字';
                }
            }
            ,xyh: [
                /^\d{6}CY\d{4}$/
                ,'12位数7和8位是CY'
            ]
            ,jgjc: function(value){
                if (value.length>8) {
                    return '不得超过8个字';
                }
            }
            ,jggd:[
                /^$|^[0-9]+(.[0-9]{6})?$/
                ,'经度格式不正确'
            ]
            ,jgwd:[
                /^$|^[0-9]+(.[0-9]{6})?$/
                ,'纬度格式不正确'
            ]
            ,diz:function (value) {
                if (value.length>50) {
                    return '不得超过50个字';
                }
            }
            ,content: function(value){
                layedit.sync(editIndex);
            }

        });
    });
</script>

<script th:src="@{/js/systemManager/organ.js}"></script>
</body>
</html>